////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include "Obstacle.hpp"

#include <SmegCore/Entity/EntityManager.hpp>
#include <SmegCore/Math/BoundingVolumes/Circle.hpp>

#include <SmegTools/Debug/DebugNew.hpp>
        
////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////
Obstacle::Obstacle() :
    smeg::core::BaseEntity()
{
    ComputeBoundingVolume();
    smeg::core::EntityManager::GetInstance()->AddEntity( this );
}
    
////////////////////////////////////////////////////////////
/// Constructor with a texture
////////////////////////////////////////////////////////////
Obstacle::Obstacle( const sf::Texture* _pTexture ) :
    smeg::core::BaseEntity( _pTexture )
{
    ComputeBoundingVolume();
    smeg::core::EntityManager::GetInstance()->AddEntity( this );
}
    
////////////////////////////////////////////////////////////
/// Constructor with a texture and a rectangle
////////////////////////////////////////////////////////////
Obstacle::Obstacle( const sf::Texture* _pTexture, const sf::IntRect& _Rectangle ) :
    smeg::core::BaseEntity( _pTexture, _Rectangle )
{
    ComputeBoundingVolume();
    smeg::core::EntityManager::GetInstance()->AddEntity( this );
}
    
////////////////////////////////////////////////////////////
/// Copy Constructor
////////////////////////////////////////////////////////////
Obstacle::Obstacle( const Obstacle& _Copy ) :
    smeg::core::BaseEntity( _Copy )
{
    ComputeBoundingVolume();
    smeg::core::EntityManager::GetInstance()->AddEntity( this );
}
    
////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////
Obstacle::~Obstacle()
{
}

void Obstacle::ComputeBoundingVolume()
{
    m_pBoundingVolume = new smeg::math::Circle( getPosition(), smeg::math::RandRange( 20.0f, 50.0f ) );

    smeg::core::BaseEntity::ComputeBoundingVolume();
}

